package com.zcx.qshop.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2015/9/2 0002.
 */
@HttpInlet(Conn.INLET_JSON_ORDERRESULT)
public class JsonOrderresultAsyGet extends QSAsyGet<JsonOrderresultAsyGet.Info> {

    public String uid, action, shopcarid, pid, gattributeid, number, name, mobile, address, couponid, buyremark;

    public JsonOrderresultAsyGet(String uid, String action, String shopcarid, String pid, String gattributeid, String number, String name, String mobile, String address, String couponid, String buyremark, AsyCallBack<Info> asyCallBack) {

        super(asyCallBack);

        this.uid = uid;

        this.action = action;

        this.shopcarid = shopcarid;

        this.pid = pid;

        this.gattributeid = gattributeid;

        this.number = number;

        this.name = name;

        this.mobile = mobile;

        this.address = address;

        this.couponid = couponid;

        this.buyremark = buyremark;

    }

    @Override
    public Info parser(JSONObject object) {

        if(object.optString("message").equals("1")){

            Info info = new Info();

            info.ordernumber = object.optString("ordernumber");

            info.money = object.optString("money");

            return info;

        }

        return null;

    }

    public static class Info{

        public String ordernumber, money;

    }

}
